-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: join field works on collections with versions enabled #8715
base: beta
Are you sure you want to change the base?
fix: join field works on collections with versions enabled #8715
Conversation
f5bdb79
to
44d578e
Compare
b5533f0
to
9434429
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few small open questions. This might be good to merge as-is, but I'd like to get your thoughts first.
@@ -74,6 +74,7 @@ export const init: Init = async function init(this: BasePostgresAdapter) { | |||
disableNotNull: !!collection.versions?.drafts, | |||
disableUnique: true, | |||
fields: versionFields, | |||
joins: collection.joins, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this being used any longer since you deleted the case 'join' field in traverseFields?
@@ -936,30 +936,6 @@ export const traverseFields = ({ | |||
|
|||
break | |||
|
|||
case 'join': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we are not using the relationship any more, I'm wondering if it isn't good to keep just for somebody who might want to do their own drizzle queries later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have the afterSchemaInit
thing (which includes schema.relationships
), they can add their relationships there as they would like. I also feel like we should have some nice drizzle types generation, as for now it's not easy to use those.
Currently, even with using the introspection feature, relationships won't appear because those aren't defined in the database, not sure how we can solve this nicely
joins
todb.queryDrafts
to have them when doing.find
withdraft: true